#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main (int argc, char const* argv[])
{
    int n, start, level, t, i, ans;

    while (scanf("%d", &n) != EOF) {
        if (0 == n) break;

        start = 0; ans = 0;
        for (i = 0; i < n; i++) {
            scanf("%d", &t);
            level = start - t;
            if (level < 0) {
                ans += abs(level * 6);
            } else {
                ans += abs(level * 4);
            }
            ans += 5;
            start = t;
        }

        printf("%d\n", ans);
    }

    return 0;
}
